package dnl.utils.jdbc.impexp;

import dnl.persistence.JdbcToCsv;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;
import java.io.File;

/**
 * @author Daniel Orr
 */
@Component
public class JdbcExportPg {

    @Autowired
    JdbcTemplate jdbcTemplate;

    @Autowired
    DataSource exportDataSource;

    void export() throws Exception {
        final File exportDir = new File("C:/temp/export1020");
        JdbcExport jdbcExport = new JdbcExport(exportDataSource, exportDir, "VBD_USER_ACTIVITY", "VBD_AGENT_REPORTS", "VBD_FEEDBACK", "VBD_AUDIT");
        jdbcExport.export();
    }

    public static void main(String[] args) throws Exception {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext-pg.xml");
        final JdbcExportPg jdbcExportPg = (JdbcExportPg) applicationContext.getBean("jdbcExportPg");
        jdbcExportPg.export();
    }
}
